Repository navigation
A self-hosted install reads its own AWS account with its own roles - #516
Merged
Merged
Conversation
A self-hosted install connected to its own AWS account read it through the
CoderHelmLogReader role a person created, so every release that read a
little more asked that person to launch an update stack in AWS ("Update in
AWS"). The install's own stack already deploys into that account and can
carry those permissions itself.
- The gateway's and worker's roles get this release's read-only
permissions in their own account as a managed policy, read from the
update template the services check roles against, so the list can't
drift. Each version update brings any new permission.
- In the install's own account the log reader is read with the function's
own role (live/aws.rs install_target). Connecting still proves the
team's CoderHelmLogReader role with its External ID; other accounts and
the hosted deployment keep the role and its update flow.
- The permissions check marks the install's own account. It never offers
the update stack there; a missing permission says it arrives with the
next version update.
- The boundary allows the read-only Airflow, ECS and ECR calls and the
role's check of its own permissions, and writes its session actions as
wildcards to stay within IAM's size limit.
- The native policy simulation is regenerated. Its script resolves a
parent role's ARN passed to a part, and records the table handler's new
bulk-operation call as unused (the tables never start one).
nambok
force-pushed
the
selfhost-own-account-read
branch
from
November 7, 2026 18:37
1d2dea9 to
ba1b2da
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A self-hosted install connected to its own AWS account showed "Update needed: N new read-only permissions" with an Update in AWS button. That button launches a second stack,
CoderHelmLogReaderUpdate-<id>, to add permissions to aCoderHelmLogReaderrole a person created by hand. An install runs inside that same account, and its own stack already deploys there. So whatever a release reads should arrive with the version update, without a person launching a stack.With this change, the install reads its own account with its gateway's and worker's own roles. The install's stack gives those roles this release's read-only permissions. The card never shows Update in AWS for the install's own account.
Changes
Infra
infra/lib/own-account-read.tsadds a managed policy to the gateway's and worker's roles, on self-hosted installs only (layout: single-origin).infra/cfn/coderhelm-log-reader-update.yaml. That is the same template the services check roles against, so the two lists can't drift apart.iam:SimulatePrincipalPolicy) is pointed at the function's own role.INSTALL_OWN_ROLE_ARN.infra/lib/access.ts: the boundary now allows the read-only Airflow (Get*,List*,InvokeRestApi), ECS (Describe*,List*) and ECR (BatchGetImage,List*) calls, andiam:Simulate*on the install's own roles.sts:AssumeRole*andsts:AssumeRoleWith*. These cover the same actions as before.Services
live/aws.rs:install_targetswaps a connectedCoderHelmLogReaderin the install's own account for the function's own role, andassumethen uses the function's own credentials. Nothing else is swapped:INSTALL_OWN_ROLE_ARN.routes/log_analyzer.rs, which calls STS directly). So reading with the install's role happens only for an account the team was granted.live/permissions.rs: the check runs on the function's own role and marksinstall_account.routes/integrations.rsandroutes/connectors.rs: noupdate_urlfor the install's own account, and the card carriesinstall_account.Docs:
docs/self-host/integrations.mddescribes how the install reads its own account.The dashboard counterpart is linked below. It shows "These read-only permissions come with the next version update" with a link to Version and updates, and no Update in AWS button.
Verification
cargo test -p common --lib -- live::aws live::permissions: 39 passed. New tests:the_install_account_reads_with_the_install_roleandother_accounts_roles_and_installs_keep_their_role;the_install_account_is_never_offered_an_update_stack,another_account_still_gets_the_update_stackanda_check_saved_before_the_install_fields_still_reads.infra:tscis clean. New synth tests:log_reader::ABILITIES. That policy is read-only, checks permissions only on the function's own role, and the function names its role.infra/test/fixtures/native-sim.jsonregenerated withpython3 infra/scripts/deploy-role-sim.py --native(read-only:DescribeType,SimulateCustomPolicy). 3,204 (action, resource) pairs simulated, 63 registry calls not simulated. Two fixes to the script were needed, neither caused by this change:DeployRoleArnfrom a parent resource (Fn::GetAtt DeployRole.Arn). The script assumed everyGetAttpointed at a child stack, so its synth step crashed before any AWS call. It now resolves a parent role's ARN.dynamodb:DescribeBulkOperationto the table's handler permissions. That action acts on its ownbulk-operation/<id>resource, and the install's tables never start one (no import source). It is now recorded as unused, the way the script already handles calls a template never triggers.npm testininfra: 147 passed, 0 failed.